home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevMac / CIncludes / QD3DStorage.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  8.2 KB  |  299 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DStorage.h
  3.  
  4.      Contains:    Abstraction to deal with various types of stream-based storage devices        
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3DSTORAGE__
  19. #define __QD3DSTORAGE__
  20.  
  21. #ifndef __QD3D__
  22. #include <QD3D.h>
  23. #endif
  24.  
  25. #if TARGET_OS_MAC
  26. #ifndef __MACTYPES__
  27. #include <MacTypes.h>
  28. #endif
  29. #ifndef __FILES__
  30. #include <Files.h>
  31. #endif
  32. #endif  /* TARGET_OS_MAC */
  33.  
  34.  
  35. #if TARGET_OS_WIN32
  36.     #include <windows.h>
  37. #endif /* TARGET_OS_WIN32 */
  38.  
  39. #include <stdio.h>
  40.  
  41.  
  42. #if PRAGMA_ONCE
  43. #pragma once
  44. #endif
  45.  
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif
  49.  
  50. #if PRAGMA_IMPORT
  51. #pragma import on
  52. #endif
  53.  
  54. #if PRAGMA_STRUCT_ALIGN
  55.     #pragma options align=power
  56. #elif PRAGMA_STRUCT_PACKPUSH
  57.     #pragma pack(push, 2)
  58. #elif PRAGMA_STRUCT_PACK
  59.     #pragma pack(2)
  60. #endif
  61.  
  62. #if PRAGMA_ENUM_ALWAYSINT
  63.     #pragma enumsalwaysint on
  64. #elif PRAGMA_ENUM_OPTIONS
  65.     #pragma option enum=int
  66. #elif PRAGMA_ENUM_PACK
  67.     #if __option(pack_enums)
  68.         #define PRAGMA_ENUM_PACK__QD3DSTORAGE__
  69.     #endif
  70.     #pragma options(!pack_enums)
  71. #endif
  72.  
  73. /******************************************************************************
  74.  **                                                                             **
  75.  **                                Storage Routines                             **
  76.  **                                                                             **
  77.  *****************************************************************************/
  78. EXTERN_API_C( TQ3ObjectType )
  79. Q3Storage_GetType                (TQ3StorageObject         storage);
  80.  
  81. EXTERN_API_C( TQ3Status )
  82. Q3Storage_GetSize                (TQ3StorageObject         storage,
  83.                                  unsigned long *        size);
  84.  
  85. /* 
  86.  *    Reads "dataSize" bytes starting at offset in storage, copying into data. 
  87.  *    sizeRead returns the number of bytes filled in. 
  88.  *    
  89.  *    You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeRead
  90.  */
  91. EXTERN_API_C( TQ3Status )
  92. Q3Storage_GetData                (TQ3StorageObject         storage,
  93.                                  unsigned long             offset,
  94.                                  unsigned long             dataSize,
  95.                                  unsigned char *        data,
  96.                                  unsigned long *        sizeRead);
  97.  
  98. /* 
  99.  *    Write "dataSize" bytes starting at offset in storage, copying from data. 
  100.  *    sizeWritten returns the number of bytes filled in. 
  101.  *    
  102.  *    You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeWritten
  103.  */
  104. EXTERN_API_C( TQ3Status )
  105. Q3Storage_SetData                (TQ3StorageObject         storage,
  106.                                  unsigned long             offset,
  107.                                  unsigned long             dataSize,
  108.                                  const unsigned char *    data,
  109.                                  unsigned long *        sizeWritten);
  110.  
  111. /******************************************************************************
  112.  **                                                                             **
  113.  **                             Memory Storage Prototypes                         **
  114.  **                                                                             **
  115.  *****************************************************************************/
  116. EXTERN_API_C( TQ3ObjectType )
  117. Q3MemoryStorage_GetType            (TQ3StorageObject         storage);
  118.  
  119. /*
  120.  * These calls COPY the buffer into QD3D space
  121.  */
  122. EXTERN_API_C( TQ3StorageObject )
  123. Q3MemoryStorage_New                (const unsigned char *    buffer,
  124.                                  unsigned long             validSize);
  125.  
  126. EXTERN_API_C( TQ3Status )
  127. Q3MemoryStorage_Set                (TQ3StorageObject         storage,
  128.                                  const unsigned char *    buffer,
  129.                                  unsigned long             validSize);
  130.  
  131. /*
  132.  * These calls use the pointer given - you must dispose it when you're through
  133.  */
  134. EXTERN_API_C( TQ3StorageObject )
  135. Q3MemoryStorage_NewBuffer        (unsigned char *        buffer,
  136.                                  unsigned long             validSize,
  137.                                  unsigned long             bufferSize);
  138.  
  139. EXTERN_API_C( TQ3Status )
  140. Q3MemoryStorage_SetBuffer        (TQ3StorageObject         storage,
  141.                                  unsigned char *        buffer,
  142.                                  unsigned long             validSize,
  143.                                  unsigned long             bufferSize);
  144.  
  145. EXTERN_API_C( TQ3Status )
  146. Q3MemoryStorage_GetBuffer        (TQ3StorageObject         storage,
  147.                                  unsigned char **        buffer,
  148.                                  unsigned long *        validSize,
  149.                                  unsigned long *        bufferSize);
  150.  
  151. #if TARGET_OS_MAC
  152. /******************************************************************************
  153.  **                                                                             **
  154.  **                                Macintosh Handles Prototypes                 **
  155.  **                                                                             **
  156.  *****************************************************************************/
  157. /* Handle Storage is a subclass of Memory Storage */
  158. EXTERN_API_C( TQ3StorageObject )
  159. Q3HandleStorage_New                (Handle                 handle,
  160.                                  unsigned long             validSize);
  161.  
  162. EXTERN_API_C( TQ3Status )
  163. Q3HandleStorage_Set                (TQ3StorageObject         storage,
  164.                                  Handle                 handle,
  165.                                  unsigned long             validSize);
  166.  
  167. EXTERN_API_C( TQ3Status )
  168. Q3HandleStorage_Get                (TQ3StorageObject         storage,
  169.                                  Handle *                handle,
  170.                                  unsigned long *        validSize);
  171.  
  172. /******************************************************************************
  173.  **                                                                             **
  174.  **                                Macintosh Storage Prototypes                 **
  175.  **                                                                             **
  176.  *****************************************************************************/
  177. EXTERN_API_C( TQ3StorageObject )
  178. Q3MacintoshStorage_New            (short                     fsRefNum);
  179.  
  180. /* Note: This storage is assumed open */
  181. EXTERN_API_C( TQ3Status )
  182. Q3MacintoshStorage_Set            (TQ3StorageObject         storage,
  183.                                  short                     fsRefNum);
  184.  
  185. EXTERN_API_C( TQ3Status )
  186. Q3MacintoshStorage_Get            (TQ3StorageObject         storage,
  187.                                  short *                fsRefNum);
  188.  
  189. EXTERN_API_C( TQ3ObjectType )
  190. Q3MacintoshStorage_GetType        (TQ3StorageObject         storage);
  191.  
  192.  
  193. /******************************************************************************
  194.  **                                                                             **
  195.  **                            Macintosh FSSpec Storage Prototypes                 **
  196.  **                                                                             **
  197.  *****************************************************************************/
  198. EXTERN_API_C( TQ3StorageObject )
  199. Q3FSSpecStorage_New                (const FSSpec *            fs);
  200.  
  201. EXTERN_API_C( TQ3Status )
  202. Q3FSSpecStorage_Set                (TQ3StorageObject         storage,
  203.                                  const FSSpec *            fs);
  204.  
  205. EXTERN_API_C( TQ3Status )
  206. Q3FSSpecStorage_Get                (TQ3StorageObject         storage,
  207.                                  FSSpec *                fs);
  208.  
  209. #endif  /* TARGET_OS_MAC */
  210.  
  211. #if TARGET_OS_WIN32
  212. /******************************************************************************
  213.  **                                                                             **
  214.  **                            Win32 HANDLE Storage Prototypes                     **
  215.  **                                                                             **
  216.  *****************************************************************************/
  217. EXTERN_API_C( TQ3StorageObject )
  218. Q3Win32Storage_New                (HANDLE                 hFile);
  219.  
  220. EXTERN_API_C( TQ3Status )
  221. Q3Win32Storage_Set                (TQ3StorageObject         storage,
  222.                                  HANDLE                 hFile);
  223.  
  224. EXTERN_API_C( TQ3Status )
  225. Q3Win32Storage_Get                (TQ3StorageObject         storage,
  226.                                  HANDLE *                hFile);
  227.  
  228. #endif  /* TARGET_OS_WIN32 */
  229.  
  230.  
  231. /******************************************************************************
  232.  **                                                                             **
  233.  **                                    Unix Prototypes                             **
  234.  **                                                                             **
  235.  *****************************************************************************/
  236. EXTERN_API_C( TQ3StorageObject )
  237. Q3UnixStorage_New                (FILE *                    storage);
  238.  
  239. EXTERN_API_C( TQ3Status )
  240. Q3UnixStorage_Set                (TQ3StorageObject         storage,
  241.                                  FILE *                    stdFile);
  242.  
  243. EXTERN_API_C( TQ3Status )
  244. Q3UnixStorage_Get                (TQ3StorageObject         storage,
  245.                                  FILE **                stdFile);
  246.  
  247. EXTERN_API_C( TQ3ObjectType )
  248. Q3UnixStorage_GetType            (TQ3StorageObject         storage);
  249.  
  250. /******************************************************************************
  251.  **                                                                             **
  252.  **                                Unix Path Prototypes                         **
  253.  **                                                                             **
  254.  *****************************************************************************/
  255. EXTERN_API_C( TQ3StorageObject )
  256. Q3UnixPathStorage_New            (const char *            pathName);
  257.  
  258. /* C string */
  259. EXTERN_API_C( TQ3Status )
  260. Q3UnixPathStorage_Set            (TQ3StorageObject         storage,
  261.                                  const char *            pathName);
  262.  
  263. /* C string */
  264. EXTERN_API_C( TQ3Status )
  265. Q3UnixPathStorage_Get            (TQ3StorageObject         storage,
  266.                                  char *                    pathName);
  267.  
  268. /* pathName is a buffer */
  269.  
  270.  
  271. #if PRAGMA_ENUM_ALWAYSINT
  272.     #pragma enumsalwaysint reset
  273. #elif PRAGMA_ENUM_OPTIONS
  274.     #pragma option enum=reset
  275. #elif defined(PRAGMA_ENUM_PACK__QD3DSTORAGE__)
  276.     #pragma options(pack_enums)
  277. #endif
  278.  
  279. #if PRAGMA_STRUCT_ALIGN
  280.     #pragma options align=reset
  281. #elif PRAGMA_STRUCT_PACKPUSH
  282.     #pragma pack(pop)
  283. #elif PRAGMA_STRUCT_PACK
  284.     #pragma pack()
  285. #endif
  286.  
  287. #ifdef PRAGMA_IMPORT_OFF
  288. #pragma import off
  289. #elif PRAGMA_IMPORT
  290. #pragma import reset
  291. #endif
  292.  
  293. #ifdef __cplusplus
  294. }
  295. #endif
  296.  
  297. #endif /* __QD3DSTORAGE__ */
  298.  
  299.